<!DOCTYPE html>
<HTML>
<HEAD><meta name="viewport" content="width=device-width, initial-scale=1">
<Title>BaseChart.setResource</Title>
<link type='text/css' rel='Stylesheet' href="maxchartapi.css" />
</HEAD>
<body bgcolor="#FFFFFF" text="#000000" topmargin="0" leftmargin="0" rightmargin="0" marginwidth="0" marginheight="0">

<p class="heading0">ChartDirector 7.0 (Java Edition)</p>
<p class="heading1"><a href="BaseChart.htm">BaseChart</a>.<wbr>setResource</p>
<hr class="separator">
<p class="heading2a">Usage</p>
<div class="content">
public void setResource(String id, byte[] img)
</div>
<p class="heading2">Description</p>
<div class="content">
Assigns a resource ID to a memory block to allow it to be referenced using a resource path.<br><br>
Many ChartDirector features, such as <a href="BaseChart.setBgImage.htm">BaseChart.setBgImage</a> and the &lt;*img*&gt; tag in <a href="cdml.htm">CDML</a>, expect a <a href="pathspec.htm">file or resource path</a> for loading an image. If the image happens to be in memory, such as if the image is retrieved from a database, setResource can be used to assign a resource ID to the memory. It can then be referenced using "@/<i>res_id</i>", in which <i>res_id</i> is the resource ID.<br><br>
The assigned resource ID is only valid for the <a href="BaseChart.htm">BaseChart</a> object of which this method is called. Use <a href="Chart.setResource.htm">Chart.setResource</a> to assign a resource ID that is valid for all ChartDirector objects.<br><br>
This method only saves a  to the memory. It does not copy the memory. You must ensure the memory contains valid content for as long as the resource is being used.
</div>
<p class="heading2">Arguments</p>
<div class="content">
<div style="width:100%;box-sizing:border-box;">
<table border="1" cellpadding="5" cellspacing="0" width="100%"> 
<tr>
<th width="19%">Argument</th><th width="19%">Default</th><th>Description</th>
</tr>
<tr>
<td>id</td><td>(Mandatory)</td><td>The resource ID to be used to reference the memory image.</td></tr><tr><td>img</td><td>(Mandatory)</td><td>The memory that the image occupies.</td>
</tr>
</table>
</div>
</div>
<p class="heading2">Return Value</p>
<div class="content">
None
</div>
<br><hr class="separator">
<div class="copyright">&copy; 2022 Advanced Software Engineering Limited. All rights reserved.</div>
</body>
</HTML>
